home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 1
/
Precision Software Applications Silver Collection Volume One (PSM) (1993).iso
/
children
/
mazes4.exe
/
LISTMAZE.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-01-31
|
3KB
|
101 lines
1 DEFINT A-Z:PRINT
2 PRINT"Number of columns";:INPUT C:IF C>1 THEN 4
3 PRINT"? The number of columns must be at least 2":GOTO 2
4 PRINT:O=2*C:P=O+1
5 PRINT"Number of rows";:INPUT R:IF R>1 THEN 7
6 PRINT"? The number of rows must be at least 2":GOTO 5
7 PRINT:W=2*R+1:DIM Z(P*W+2*C*R+200):PRINT"Seed";:INPUT S:PRINT:S=ABS(S)
8 FOR T=1 TO 8:G=INT(S/29):H=S-29*G:S=G:IF H<>0 THEN 10
9 H=19
10 Z(T)=H:NEXT T:Z(9)=-1:Z(105)=0:Z(10)=0:Z(106)=1:Z(11)=1:Z(107)=0:Z(12)=0
11 Z(108)=-1:J=8:N=104:FOR A=1 TO 4:FOR B=1 TO 4:IF A=B THEN 21
12 FOR D=1 TO 4:IF A=D THEN 20
13 IF B=D THEN 20
14 FOR E=1 TO 4:IF A=E THEN 19
15 IF B=E THEN 19
16 IF D=E THEN 19
17 Z(A+J)=Z(9):Z(B+J)=Z(10):Z(D+J)=Z(11):Z(E+J)=Z(12):J=J+4
18 Z(A+N)=Z(105):Z(B+N)=Z(106):Z(D+N)=Z(107):Z(E+N)=Z(108):N=N+4
19 NEXT E
20 NEXT D
21 NEXT B:NEXT A:T=201:FOR U=1 TO W:FOR M=1 TO P:Z(T)=1:T=T+1:NEXT M:NEXT U
22 T=INT(C/2):T=C-2*T:IF T<>0 THEN 24
23 X=C:GOTO 25
24 X=C+1
25 T=INT(R/2):T=R-2*T:IF T<>0 THEN 27
26 Y=R:GOTO 28
27 Y=R+1
28 V=200+P*W:F=V:GOTO 77
29 Z(202)=0:Z(200+P*(W-1)+O)=0:PRINT CHR$(201);" ";:T=1:N=200+P+2
30 FOR M=3 TO O:N=N+1:IF T=0 THEN 34
31 IF Z(N)=1 THEN 33
32 PRINT CHR$(205);:GOTO 35
33 PRINT CHR$(203);:GOTO 35
34 PRINT CHR$(205);
35 T=1-T:NEXT M:PRINT CHR$(187):U=3
36 IF U>=W THEN 95
37 T=1:N=200+P*(U-1):FOR M=1 TO P:N=N+1:V=N+P:IF T<>0 THEN 41
38 IF Z(N)=1 THEN 40
39 PRINT" ";:GOTO 76
40 PRINT CHR$(205);:GOTO 76
41 IF Z(N-P)=1 THEN 60
42 IF M=1 THEN 44
43 IF Z(N-1)=1 THEN 52
44 IF M=P THEN 46
45 IF Z(N+1)=1 THEN 49
46 IF Z(V)=1 THEN 48
47 PRINT" ";:GOTO 76
48 PRINT CHR$(186);:GOTO 76
49 IF Z(V)=1 THEN 51
50 PRINT CHR$(205);:GOTO 76
51 PRINT CHR$(201);:GOTO 76
52 IF M=P THEN 54
53 IF Z(N+1)=1 THEN 57
54 IF Z(V)=1 THEN 56
55 PRINT CHR$(205);:GOTO 76
56 PRINT CHR$(187);:GOTO 76
57 IF Z(V)=1 THEN 59
58 PRINT CHR$(205);:GOTO 76
59 PRINT CHR$(203);:GOTO 76
60 IF M=1 THEN 62
61 IF Z(N-1)=1 THEN 68
62 IF M=P THEN 64
63 IF Z(N+1)=1 THEN 65
64 PRINT CHR$(186);:GOTO 76
65 IF Z(V)=1 THEN 67
66 PRINT CHR$(200);:GOTO 76
67 PRINT CHR$(204);:GOTO 76
68 IF M=P THEN 70
69 IF Z(N+1)=1 THEN 73
70 IF Z(V)=1 THEN 72
71 PRINT CHR$(188);:GOTO 76
72 PRINT CHR$(185);:GOTO 76
73 IF Z(V)=1 THEN 75
74 PRINT CHR$(202);:GOTO 76
75 PRINT CHR$(206);:GOTO 76
76 T=1-T:NEXT M:PRINT:U=U+2:GOTO 36
77 Z(200+P*(Y-1)+X)=0:I=1
78 J=Z(1):G=1:FOR H=2 TO 8:T=Z(H):Z(G)=T:J=J+T:IF J<=29 THEN 80
79 J=J-29
80 G=H:NEXT H:Z(8)=J:IF J>24 THEN 78
81 IF I>4 THEN 93
82 N=I+4*(J-1):K=X+2*Z(8+N):IF K<=1 THEN 92
83 IF K>=P THEN 92
84 Q=Y+2*Z(104+N):IF Q<=1 THEN 92
85 IF Q>=W THEN 92
86 IF Z(200+P*(Q-1)+K)<>1 THEN 92
87 IF X<>K THEN 89
88 Z(200+P*(((Y+Q)/2)-1)+K)=0:GOTO 90
89 Z(200+P*(Q-1)+(X+K)/2)=0
90 X=K:Y=Q:V=V+1:Z(V)=I:V=V+1:Z(V)=J:GOTO 77
91 N=I+4*(J-1):X=X-2*Z(8+N):Y=Y-2*Z(104+N):GOTO 81
92 I=I+1:GOTO 81
93 N=200+P*W:J=Z(V):V=V-1:I=Z(V):V=V-1:IF F=V THEN 29
94 GOTO 91
95 PRINT CHR$(200);:T=0:FOR M=2 TO O-1:IF T=0 THEN 99
96 IF Z(200+P*(U-2)+M)=1 THEN 98
97 PRINT CHR$(205);:GOTO 100
98 PRINT CHR$(202);:GOTO 100
99 PRINT CHR$(205);
100 T=1-T:NEXT M:PRINT" ";CHR$(188):END